package net.homeip.jcperera.nu.beans;

import java.io.Serializable;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;

import net.homeip.jcperera.nu.core.msg.Logging;

@ManagedBean
public class MessagingController implements Serializable
{
    // Required to implement the Serializable interface
    private static final long serialVersionUID = 3016952283158300002L;

    @EJB
    Logging                   logging;

    public MessagingController()
    {
    }

    public void addSystemMessagesToFacesContext()
    {
        logging.addAllSystemMessagesToFacesContext(FacesContext.getCurrentInstance());
    }

    /**
     * Simple mockup to call the method exposing it as if it were a property named "systemMessagesToFacesContext"
     * 
     * @return Always an empty {@link String}
     */
    public String getSystemMessagesToFacesContext()
    {
        addSystemMessagesToFacesContext();
        return "";
    }
}
